package com.znxs.bs_c.exception;

import com.znxs.bs_c.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * author         软件21304赵鹏鑫
 * date           2023/8/16 16:32
 * Znxs~Product   [globalExceptionHandler]
 * 全局异常处理器
 * @author 左拿*/
@ControllerAdvice
public class globalExceptionHandler {
    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public Result handle(ServiceException se){
        return Result.error(se.getCode(), se.getMessage());
    }
}
